Load libraries
library(readxl)
library(tidyverse)
library(DrugScreenExplorer)
library(jyluMisc)
library(RColorBrewer)
library(cowplot)
library(parallel)
Define variables
opt <- list()
opt$drugscreen <- "data/submission/drugScreens_pseudo.RDS"
opt$druganno <- "misc/drugList_suppl.xlsx"
opt$plot <- "plots/SFig1/"
Load drug screen data and annotations
drugList <- readRDS(opt$drugscreen)
drugAnno <- read_excel(opt$druganno) %>%
dplyr::select(-Screen, -Supplier) %>% unique()
Screen A - Top 100
embl2014 <- drugList[["ScreenA"]] # get embl2014 data
## index concentrations
embl2014.ind <- mclapply(unique(embl2014$name), mc.cores = 4, function(x) {
message("Running ", x)
embl2014.x <- dplyr::filter(embl2014, name == x) %>%
mutate(conc = as.numeric(conc))
subTab <- embl2014.x %>%
dplyr::select(name, conc, concIndex) %>% arrange(desc(conc)) %>% unique()
subTab$Index <- seq(1:nrow(subTab))
message("Adding ", nrow(subTab), " indices")
subTab %>% left_join(embl2014.x, by = c("name", "conc", "concIndex"))
}) %>% bind_rows()
## compute the mean druf effect per patient x drug
viabTab <- embl2014.ind %>% dplyr::filter(!is.na(name), !is.na(diagnosis)) %>%
dplyr::filter(!name %in% c("PBS", "DMSO")) %>%
group_by(patientID, name, diagnosis) %>%
mutate(value = mean(viab.auc, na.rm = TRUE)) %>%
ungroup() %>%
left_join(dplyr::select(drugAnno, Drug, Target, Pathway),
by = c("name" = "Drug"))
topN <- 100 # define the number of drugs to plot
colorCode <- rev(brewer.pal(6,"Blues"))[1:6] # define colour scheme
## Subset to T-PLL patients
viabTab <- dplyr::filter(viabTab, diagnosis == "T-PLL") %>%
mutate(Index = factor(Index)) %>%
dplyr::select(patientID, diagnosis, name, Target, Pathway, viab.auc, value, viab, concIndex, Index) %>%
unique()
## reshuffle before plotting
set.seed(100)
viabTab <- viabTab[sample(1:nrow(viabTab),nrow(viabTab)), ]
p <- lapply(unique(viabTab$diagnosis), function(n) {
eachTab <- filter(viabTab, diagnosis == n)
drugOrder <- group_by(eachTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
eachTab <- filter(eachTab, name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
concIndex = as.factor(concIndex)) %>%
group_by(name) %>% mutate(medVal = median(value, na.rm = TRUE)) %>%
ungroup()
eachTab <- eachTab %>% select(-concIndex, -Index, -viab) %>% unique()
p <- ggplot(eachTab, aes(x=name,y = viab.auc#, colour = Index
)) +
geom_jitter(alpha=0.8, shape = 21, fill = "#64B5F6", size = 2, height = 0) +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_color_manual(values = colorCode) +
ylab("Viability") + ylim(c(0,1.5)) + xlab("") +
theme_classic() +
theme(text = element_text(size = 17.5),
axis.text.x = element_blank(),
#axis.text.x = element_text(angle = 90, hjust = 1, vjust=0.5),
axis.line = element_line(linewidth = 0.75),
#legend.position = "none",
legend.key = element_blank(),
plot.title = element_text(hjust=0.5),
axis.ticks = element_blank(),
plot.margin = unit(c(0.5, 0.5, -0.5, 0), "cm"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.background = element_rect(fill='transparent'),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA)) +
guides(colour = guide_legend(override.aes = list(size=3.5), title="Concentration\nIndex"))
})
## Make pathway annotation
drugOrder <- group_by(viabTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
pathTab <- select(viabTab, name, Pathway) %>% unique() %>%
filter(name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
type = "pathway") %>%
mutate(Pathway = ifelse(Pathway %in% c("HDAC", "HDM", "BET", "HMT", "HAT", "HMT, MYC", "NFKB, HDAC, DNA Damage"), "Epigenome", Pathway)) %>%
mutate(Pathway = ifelse(Pathway %in% c("DNA Damage"), "TP53", Pathway)) %>%
mutate(Pathway = ifelse(Pathway %in% c("Epigenome", "Apoptosis", "PI3K-AKT-mTOR", "Autophagy", "Cell Cycle", "MAPK",
"TP53", "JAK-STAT", "Chemo"), Pathway, "Other"))
pPath <- pathTab %>%
mutate(Pathway = factor(Pathway, levels = c("Epigenome", "Apoptosis", "PI3K-AKT-mTOR", "Autophagy", "Cell Cycle", "MAPK",
"TP53", "JAK-STAT", "Chemo", "Other"))) %>%
ggplot(aes(x = name, y = type, fill = Pathway)) +
geom_tile(colour = "black", size = 0.1) +
xlab("") + ylab("") +
coord_cartesian(expand = FALSE) +
scale_fill_manual(values = c("Epigenome" = "#4DB6AC", "Apoptosis" = "#AED581", "PI3K-AKT-mTOR" = "#1E88E5",
"Autophagy" = "#EF5350", "Cell Cycle" = "#FB8C00", "MAPK" = "#FFCC80",
"TP53" = "#B39DDB", "JAK-STAT" = "#F8BBD0", "Chemo" = "#FFF9C4",
"Other" = "lightgrey")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=0.5),
axis.ticks.y = element_blank(),
text = element_text(size = 12.5),
axis.text.y = element_blank(),
plot.margin = unit(c(-0, 0, 0, 0), "cm"),
legend.key = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
legend.background = element_rect(fill='transparent')
)
## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
lMain <- get_legend(p[[1]] + geom_tile(color = "black"))
## Warning in get_plot_component(plot, "guide-box"): Multiple components found;
## returning the first one. To return all, use `return_all = TRUE`.
lPath <- get_legend(pPath + geom_tile(color = "black"))
## Warning in get_plot_component(plot, "guide-box"): Multiple components found;
## returning the first one. To return all, use `return_all = TRUE`.
noLegend <- theme(legend.position = "none")
figPlot <- plot_grid(p[[1]] + noLegend, pPath + noLegend, ncol = 1, align = "v",
rel_heights = c(3, 1.4))
legPlot <- plot_grid(#lMain,
lPath, ncol = 1, align = "v")
p2 <- plot_grid(figPlot, legPlot, rel_widths = c(7, 1))
p2

ggsave(plot = p2, filename = paste0(opt$plot, "embl2014_top100.png"),
height = 6.15, width = 15)
Screen B - Overview
embl2016 <- drugList[["ScreenB"]]
## compute the mean druf effect per patient x drug
viabTab <- embl2016 %>% dplyr::filter(!is.na(name), !is.na(diagnosis)) %>%
dplyr::filter(!name %in% c("PBS", "DMSO")) %>%
group_by(patientID, name, diagnosis) %>%
mutate(value = mean(viab.auc, na.rm = TRUE)) %>%
ungroup() %>%
left_join(dplyr::select(drugAnno, Drug, Target, Pathway),
by = c("name" = "Drug"))
topN <- viabTab$name %>% unique() %>% length() # define the number of drugs to plot
colorCode <- rev(brewer.pal(9,"Blues"))[1:9] # define colour scheme
## Subset to T-PLL patients
viabTab <- dplyr::filter(viabTab, diagnosis == "T-PLL") %>%
mutate(concIndex = factor(concIndex)) %>%
dplyr::select(patientID, diagnosis, name, Target, Pathway, viab.auc, value, viab, concIndex) %>%
unique()
## reshuffle before plotting
set.seed(100)
viabTab <- viabTab[sample(1:nrow(viabTab),nrow(viabTab)), ]
## Make ranked toxicity plot
p <- lapply(unique(viabTab$diagnosis), function(n) {
eachTab <- dplyr::filter(viabTab, diagnosis == n)
drugOrder <- group_by(eachTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
eachTab <- dplyr::filter(eachTab, name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
concIndex = as.factor(concIndex)) %>%
group_by(name) %>% mutate(medVal = median(value, na.rm = TRUE)) %>%
ungroup()
drugOrder$rank <- seq(1:nrow(drugOrder))
eachTab <- left_join(eachTab, dplyr::select(drugOrder, name, rank), by = "name")
eachTab <- eachTab %>% select(-concIndex, -viab) %>% unique() %>%
mutate(viab.auc = ifelse(viab.auc > 1.5, 1.5, viab.auc))
p <- eachTab %>% filter(viab.auc < 1.5) %>%
ggplot(aes(x=rank,y = viab.auc#, colour = concIndex
)) +
geom_jitter(alpha=0.8, shape = 21, fill = "#64B5F6", size = 2, height = 0) +
geom_jitter(alpha=0.8, shape = 24, fill = "#64B5F6", size = 2, height = 0,
data = eachTab[eachTab$viab.auc >= 1.5, ]) +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_color_manual(values = colorCode) +
scale_x_continuous(expand = c(0.005,0),
labels = c(100, 200, 300, 400),
breaks = c(100, 200, 300, 400)) +
ylab("Viability") + ylim(c(0, 1.5)) +
xlab("Rank") + #ggtitle("embl2014 - Ranked Efficacy") +
theme_classic() +
theme(text = element_text(size = 25), #axis.text.x=element_blank(),
#axis.ticks.x=element_blank(),
#axis.ticks = element_blank(),
legend.key = element_blank(),
axis.line = element_line(linewidth = 0.75),
#legend.position = "none",
plot.title = element_text(hjust=0.5),
# plot.margin = unit(c(0.5, 0.5, 0.0, 0), "cm"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
#legend.direction="horizontal",
#legend.position = c(0.2, 0.25),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
legend.background = element_rect(fill='transparent')) +
guides(colour = guide_legend(override.aes = list(size=3.5), title="Concentration\nIndex"))
})
p
## [[1]]

ggsave(plot = p[[1]], filename = paste0(opt$plot, "embl2016_overview.png"),
height = 6.5, width = 15)
Screen B - Top 100
topN <- 100
p <- lapply(unique(viabTab$diagnosis), function(n) {
eachTab <- filter(viabTab, diagnosis == n)
drugOrder <- group_by(eachTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
eachTab <- filter(eachTab, name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
concIndex = as.factor(concIndex)) %>%
group_by(name) %>% mutate(medVal = median(value, na.rm = TRUE)) %>%
ungroup()
eachTab <- eachTab %>% select(-concIndex, -viab) %>% unique()
p <- ggplot(eachTab, aes(x=name,y = viab.auc#, colour = concIndex
)) +
geom_jitter(alpha=0.8, shape = 21, fill = "#64B5F6", size = 2, height = 0) +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_color_manual(values = colorCode) +
ylab("Viability") + ylim(c(0,1.2)) + xlab("") +
theme_classic() +
theme(text = element_text(size = 17.5),
axis.text.x = element_blank(),
#axis.text.x = element_text(angle = 90, hjust = 1, vjust=0.5),
axis.line = element_line(linewidth = 0.75),
#legend.position = "none",
legend.key = element_blank(),
plot.title = element_text(hjust=0.5),
axis.ticks = element_blank(),
plot.margin = unit(c(0.5, 0.5, -0.5, 0), "cm"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
legend.background = element_rect(fill='transparent'),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA)) +
guides(colour = guide_legend(override.aes = list(size=3.5), title="Concentration\nIndex"))
})
#p
## Make pathway annotation
drugOrder <- group_by(viabTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
pathTab <- select(viabTab, name, Pathway) %>% unique() %>%
filter(name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
type = "pathway") %>%
mutate(Pathway = ifelse(Pathway %in% c("HDAC", "HDM", "BET", "HMT", "HAT", "HMT, MYC", "NFKB, HDAC, DNA Damage"), "Epigenome", Pathway)) %>%
mutate(Pathway = ifelse(Pathway %in% c("DNA Damage"), "TP53", Pathway)) %>%
mutate(Pathway = ifelse(Pathway %in% c("Epigenome", "Apoptosis", "PI3K-AKT-mTOR", "Autophagy", "Cell Cycle", "MAPK", "Nuclear Traffic",
"TP53", "JAK-STAT", "Chemo"), Pathway, "Other"))
pPath <- pathTab %>%
mutate(Pathway = factor(Pathway, levels = c("Epigenome", "Apoptosis", "PI3K-AKT-mTOR", "Autophagy", "Cell Cycle", "MAPK",
"Nuclear Traffic",
"TP53", "JAK-STAT", "Chemo", "Other"))) %>%
ggplot(aes(x = name, y = type, fill = Pathway)) +
geom_tile(colour = "black", size = 0.1) +
xlab("") + ylab("") +
coord_cartesian(expand = FALSE) +
scale_fill_manual(values = c("Epigenome" = "#4DB6AC", "Apoptosis" = "#AED581", "PI3K-AKT-mTOR" = "#1E88E5",
"Nuclear Traffic" = "#90CAF9", "Autophagy" = "#EF5350",
"Cell Cycle" = "#FB8C00", "MAPK" = "#FFCC80",
"TP53" = "#B39DDB", "JAK-STAT" = "#F8BBD0",
"Chemo" = "#FFF9C4", "Other" = "lightgrey")) +
theme(axis.text.x = element_text(angle = 90, hjust = 1, vjust=0.5),
axis.ticks.y = element_blank(),
text = element_text(size = 12.5),
axis.text.y = element_blank(),
plot.margin = unit(c(-0, 0, 0, 0), "cm"),
legend.key = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
legend.background = element_rect(fill='transparent')
)
lMain <- get_legend(p[[1]] + geom_tile(color = "black"))
## Warning in get_plot_component(plot, "guide-box"): Multiple components found;
## returning the first one. To return all, use `return_all = TRUE`.
lPath <- get_legend(pPath + geom_tile(color = "black"))
## Warning in get_plot_component(plot, "guide-box"): Multiple components found;
## returning the first one. To return all, use `return_all = TRUE`.
noLegend <- theme(legend.position = "none")
figPlot <- plot_grid(p[[1]] + noLegend, pPath + noLegend, ncol = 1, align = "v",
rel_heights = c(3, 1.55))
legPlot <- plot_grid(#lMain,
lPath, ncol = 1, align = "v")
p2 <- plot_grid(figPlot, legPlot, rel_widths = c(7, 1))
p2

ggsave(plot = p2, filename = paste0(opt$plot, "embl2016_top100.png"),
height = 6.75, width = 15)
Screen C - Overview
ic50 <- drugList[["ScreenC"]]
## compute the mean druf effect per patient x drug
viabTab <- ic50 %>% dplyr::filter(!is.na(name), !is.na(diagnosis)) %>%
dplyr::filter(!name %in% c("PBS", "DMSO")) %>%
group_by(patientID, name, diagnosis) %>%
mutate(value = mean(viab.auc, na.rm = TRUE)) %>%
ungroup() %>%
left_join(dplyr::select(drugAnno, Drug, Target, Pathway),
by = c("name" = "Drug"))
topN <- viabTab$name %>% unique() %>% length() # define the number of drugs to plot
colorCode <- rev(brewer.pal(5,"Blues"))[1:5] # define colour scheme
## Subset to T-PLL patients
viabTab <- dplyr::filter(viabTab, diagnosis == "T-PLL") %>%
mutate(concIndex = factor(concIndex)) %>%
dplyr::select(patientID, diagnosis, name, Target, Pathway, viab.auc, value, viab, concIndex) %>%
unique()
## reshuffle before plotting
set.seed(100)
viabTab <- viabTab[sample(1:nrow(viabTab),nrow(viabTab)), ]
## Make ranked toxicity plot
p <- lapply(unique(viabTab$diagnosis), function(n) {
eachTab <- dplyr::filter(viabTab, diagnosis == n)
drugOrder <- group_by(eachTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
eachTab <- dplyr::filter(eachTab, name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
concIndex = as.factor(concIndex)) %>%
group_by(name) %>% mutate(medVal = median(value, na.rm = TRUE)) %>%
ungroup()
drugOrder$rank <- seq(1:nrow(drugOrder))
eachTab <- left_join(eachTab, dplyr::select(drugOrder, name, rank), by = "name")
eachTab <- eachTab %>% select(-concIndex, -viab) %>% unique() %>%
mutate(viab.auc = ifelse(viab.auc > 1.5, 1.5, viab.auc))
p <- eachTab %>% filter(viab.auc < 1.5) %>%
ggplot(aes(x=rank,y = viab.auc#, colour = concIndex
)) +
geom_jitter(alpha=0.8, shape = 21, fill = "#64B5F6", size = 2, height = 0) +
geom_jitter(alpha=0.8, shape = 24, fill = "#64B5F6", size = 2, height = 0,
data = eachTab[eachTab$viab.auc >= 1.5, ]) +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_color_manual(values = colorCode) +
scale_x_continuous(expand = c(0.005, 0), labels = c(10, 20, 30, 40, 50, 60),
breaks = c(10, 20, 30, 40, 50, 60)) +
ylab("Viability") + ylim(c(0, 1.5)) +
xlab("Rank") + #ggtitle("embl2014 - Ranked Efficacy") +
theme_classic() +
theme(text = element_text(size = 25), #axis.text.x=element_blank(),
#axis.ticks.x=element_blank(),
#axis.ticks = element_blank(),
legend.key = element_blank(),
axis.line = element_line(linewidth = 0.75),
#legend.position = "none",
plot.title = element_text(hjust=0.5),
# plot.margin = unit(c(0.5, 0.5, 0.0, 0), "cm"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
#legend.direction="horizontal",
#legend.position = c(0.2, 0.25),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
legend.background = element_rect(fill='transparent')) +
guides(colour = guide_legend(override.aes = list(size=3.5), title="Concentration\nIndex"))
})
p
## [[1]]

ggsave(plot = p[[1]], filename = paste0(opt$plot, "ic50_overview.png"),
height = 6.5, width = 15)
Screen D - Overview
cps1000 <- drugList[["ScreenD"]]
## compute the mean druf effect per patient x drug
viabTab <- cps1000 %>% dplyr::filter(!is.na(name), !is.na(diagnosis)) %>%
dplyr::filter(!name %in% c("PBS", "DMSO")) %>%
group_by(patientID, name, diagnosis) %>%
mutate(value = mean(viab.auc, na.rm = TRUE)) %>%
ungroup() %>%
left_join(dplyr::select(drugAnno, Drug, Target, Pathway),
by = c("name" = "Drug"))
topN <- viabTab$name %>% unique() %>% length() # define the number of drugs to plot
colorCode <- rev(brewer.pal(5,"Blues"))[1:5] # define colour scheme
## Subset to T-PLL patients
viabTab <- dplyr::filter(viabTab, diagnosis == "T-PLL") %>%
mutate(concIndex = factor(concIndex)) %>%
dplyr::select(patientID, diagnosis, name, Target, Pathway, viab.auc, value, viab, concIndex) %>%
unique()
## reshuffle before plotting
set.seed(100)
viabTab <- viabTab[sample(1:nrow(viabTab),nrow(viabTab)), ]
## Make ranked toxicity plot
p <- lapply(unique(viabTab$diagnosis), function(n) {
eachTab <- dplyr::filter(viabTab, diagnosis == n)
drugOrder <- group_by(eachTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
eachTab <- dplyr::filter(eachTab, name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
concIndex = as.factor(concIndex)) %>%
group_by(name) %>% mutate(medVal = median(value, na.rm = TRUE)) %>%
ungroup()
drugOrder$rank <- seq(1:nrow(drugOrder))
eachTab <- left_join(eachTab, dplyr::select(drugOrder, name, rank), by = "name")
eachTab <- eachTab %>% select(-concIndex, -viab) %>% unique() %>%
mutate(viab.auc = ifelse(viab.auc > 1.5, 1.5, viab.auc))
p <- eachTab %>% filter(viab.auc < 1.5) %>%
ggplot(aes(x=rank,y = viab.auc#, colour = concIndex
)) +
geom_jitter(alpha=0.8, shape = 21, fill = "#64B5F6", size = 2, height = 0) +
geom_jitter(alpha=0.8, shape = 24, fill = "#64B5F6", size = 2, height = 0,
data = eachTab[eachTab$viab.auc >= 1.5, ]) +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_color_manual(values = colorCode) +
scale_x_continuous(expand = c(0.005, 0), labels = c(10, 20, 30, 40, 50, 60),
breaks = c(10, 20, 30, 40, 50, 60)) +
ylab("Viability") + ylim(c(0, 1.5)) +
xlab("Rank") + #ggtitle("embl2014 - Ranked Efficacy") +
theme_classic() +
theme(text = element_text(size = 25), #axis.text.x=element_blank(),
#axis.ticks.x=element_blank(),
#axis.ticks = element_blank(),
legend.key = element_blank(),
axis.line = element_line(linewidth = 0.75),
#legend.position = "none",
plot.title = element_text(hjust=0.5),
# plot.margin = unit(c(0.5, 0.5, 0.0, 0), "cm"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
#legend.direction="horizontal",
#legend.position = c(0.2, 0.25),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
legend.background = element_rect(fill='transparent')) +
guides(colour = guide_legend(override.aes = list(size=3.5), title="Concentration\nIndex"))
})
p
## [[1]]

ggsave(plot = p[[1]], filename = paste0(opt$plot, "cps1000_overview.png"),
height = 6.5, width = 15)
Screen E - Overview
t_lymphoma <- drugList[["ScreenE"]]
## Define drug combinations
drugComb <- c("Birinapant|Necrostatin-1 (25)", "Birinapant|QVD-Oph (25)", "Birinapant|Necrostatin-1 (25)|QVD-Oph (25)",
"Birinapant|Necrostatin-1 (12.5)", "Birinapant|QVD-Oph (12.5)", "Birinapant|Necrostatin-1 (12.5)|QVD-Oph (12.5)",
"GDC-0152|Necrostatin-1 (25)", "GDC-0152|QVD-Oph (25)", "GDC-0152|Necrostatin-1 (25)|QVD-Oph (25)",
"GDC-0152|Necrostatin-1 (12.5)", "GDC-0152|QVD-Oph (12.5)", "GDC-0152|Necrostatin-1 (12.5)|QVD-Oph (12.5)",
"Birinapant|Ipatasertib (2)", "Birinapant|Ruxolitinib (2)", "Birinapant|Bafilomycin_A1 (0.08)",
"Birinapant|NSA (0.8)", "Birinapant|NSA (2)",
"Birinapant|NSA (5)", "Birinapant|NSA (0.8)|QVD-Oph (25)", "Birinapant|NSA (2)|QVD-Oph (25)",
"Birinapant|NSA (5)|QVD-Oph (25)", #"Ibrutinib|Compound 26 (0.1)",
"Birinapant + Ipatasertib 2µM", "Birinpant + Ruxolitinib 2µM", "Birinapant + Venetoclax 0.04µM",
"Birinapant + Dacinostat 0.04µM", "Birinapant + Bafilomycin A1 0.08µM", "Birinapant + NSA 0.8µM",
"Birinapant + NSA 0.8µM + QVD-Oph 25µM", "Birinapant + NSA 2µM", "Birinapant + NSA 5µM",
"Birinapant + NSA 12.5µM", "Birinapant + NSA 2µM + QVD-Oph 25µM", "Birinapant + NSA 5μM + QVD-Oph 25μM",
"Birinapant + NSA 12.5µM + QVD-Oph 25µM",
"DMSO", "empty", "Necrostatin-1|QVD-Oph")
## compute the mean druf effect per patient x drug
viabTab <- t_lymphoma %>% dplyr::filter(!is.na(name), !is.na(diagnosis)) %>%
dplyr::filter(!name %in% c("PBS", "DMSO", drugComb)) %>%
dplyr::filter(!c(name %in% c("Birinapant", "QVD-Oph") & screen == "T_lymphoma_combi")) %>% # remove birinapant at 5 concentrations
group_by(patientID, name, diagnosis) %>%
mutate(value = mean(viab.auc, na.rm = TRUE)) %>%
ungroup() %>%
left_join(dplyr::select(drugAnno, Drug, Target, Pathway),
by = c("name" = "Drug"))
topN <- viabTab$name %>% unique() %>% length() # define the number of drugs to plot
colorCode <- rev(brewer.pal(9,"Blues"))[1:9] # define colour scheme
colorCode[[10]] <- colorCode[[9]]
colorCode[[9]] <- "grey80"
## Subset to T-PLL patients
viabTab <- dplyr::filter(viabTab, diagnosis == "T-PLL") %>%
mutate(concIndex = factor(concIndex)) %>%
dplyr::select(patientID, diagnosis, name, Target, Pathway, viab.auc, value, viab, concIndex) %>%
unique()
## reshuffle before plotting
set.seed(100)
viabTab <- viabTab[sample(1:nrow(viabTab),nrow(viabTab)), ]
## Make ranked toxicity plot
p <- lapply(unique(viabTab$diagnosis), function(n) {
eachTab <- dplyr::filter(viabTab, diagnosis == n)
drugOrder <- group_by(eachTab, name) %>%
summarise(medVal = median(value, na.rm = TRUE)) %>%
arrange(medVal)
drugOrder <- drugOrder[c(seq(1,topN)), ]
eachTab <- dplyr::filter(eachTab, name %in% drugOrder$name) %>%
mutate(name = factor(name, levels = drugOrder$name),
concIndex = as.factor(concIndex)) %>%
group_by(name) %>% mutate(medVal = median(value, na.rm = TRUE)) %>%
ungroup()
drugOrder$rank <- seq(1:nrow(drugOrder))
eachTab <- left_join(eachTab, dplyr::select(drugOrder, name, rank), by = "name")
eachTab <- eachTab %>% select(-concIndex, -viab) %>% unique() %>%
mutate(viab.auc = ifelse(viab.auc > 1.5, 1.5, viab.auc))
p <- eachTab %>% filter(viab.auc < 1.5) %>%
ggplot(aes(x=rank,y = viab.auc#, colour = concIndex
)) +
geom_jitter(alpha=0.8, shape = 21, fill = "#64B5F6", size = 2, height = 0) +
geom_jitter(alpha=0.8, shape = 24, fill = "#64B5F6", size = 2, height = 0,
data = eachTab[eachTab$viab.auc >= 1.5, ]) +
geom_hline(yintercept = 1, linetype = "dashed") +
scale_color_manual(values = colorCode) +
scale_x_continuous(expand = c(0.01,0), labels = c(10, 20, 30, 40, 50),
breaks = c(10, 20, 30, 40, 50)) +
ylab("Viability") + ylim(c(0, 1.5)) +
xlab("Rank") + #ggtitle("embl2014 - Ranked Efficacy") +
theme_classic() +
theme(text = element_text(size = 25), #axis.text.x=element_blank(),
#axis.ticks.x=element_blank(),
#axis.ticks = element_blank(),
legend.key = element_blank(),
axis.line = element_line(linewidth = 0.75),
#legend.position = "none",
plot.title = element_text(hjust=0.5),
# plot.margin = unit(c(0.5, 0.5, 0.0, 0), "cm"),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
#legend.direction="horizontal",
#legend.position = c(0.2, 0.25),
panel.background = element_rect(fill = "transparent",colour = NA),
plot.background = element_rect(fill = "transparent",colour = NA),
legend.background = element_rect(fill='transparent')) +
guides(colour = guide_legend(override.aes = list(size=3.5), title="Concentration\nIndex"))
})
p
## [[1]]

ggsave(plot = p[[1]], filename = paste0(opt$plot, "validation_overview.png"),
height = 6.5, width = 15)
Output session info
sessionInfo()
## R version 4.3.2 (2023-10-31)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.3 LTS
##
## Matrix products: default
## BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
## LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so; LAPACK version 3.10.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## time zone: Etc/UTC
## tzcode source: system (glibc)
##
## attached base packages:
## [1] parallel stats graphics grDevices datasets utils methods
## [8] base
##
## other attached packages:
## [1] cowplot_1.1.3 RColorBrewer_1.1-3 jyluMisc_0.1.5
## [4] DrugScreenExplorer_0.1.0 lubridate_1.9.3 forcats_1.0.0
## [7] stringr_1.5.1 dplyr_1.1.4 purrr_1.0.2
## [10] readr_2.1.5 tidyr_1.3.1 tibble_3.2.1
## [13] ggplot2_3.5.1 tidyverse_2.0.0 readxl_1.4.3
##
## loaded via a namespace (and not attached):
## [1] rstudioapi_0.16.0 jsonlite_1.8.8
## [3] magrittr_2.0.3 TH.data_1.1-2
## [5] farver_2.1.2 rmarkdown_2.27
## [7] ragg_1.3.2 zlibbioc_1.48.2
## [9] vctrs_0.6.5 RCurl_1.98-1.14
## [11] rstatix_0.7.2 htmltools_0.5.8.1
## [13] S4Arrays_1.2.1 plotrix_3.8-4
## [15] broom_1.0.6 cellranger_1.1.0
## [17] SparseArray_1.2.4 sass_0.4.9
## [19] KernSmooth_2.23-22 bslib_0.7.0
## [21] htmlwidgets_1.6.4 sandwich_3.1-0
## [23] zoo_1.8-12 cachem_1.1.0
## [25] igraph_2.0.3 mime_0.12
## [27] lifecycle_1.0.4 piano_2.18.0
## [29] pkgconfig_2.0.3 Matrix_1.6-1.1
## [31] R6_2.5.1 fastmap_1.2.0
## [33] GenomeInfoDbData_1.2.11 rbibutils_2.2.16
## [35] MatrixGenerics_1.14.0 shiny_1.8.1.1
## [37] digest_0.6.36 colorspace_2.1-0
## [39] S4Vectors_0.40.2 tensor_1.5
## [41] textshaping_0.4.0 GenomicRanges_1.54.1
## [43] ggpubr_0.6.0 labeling_0.4.3
## [45] km.ci_0.5-6 fansi_1.0.6
## [47] timechange_0.3.0 abind_1.4-5
## [49] compiler_4.3.2 withr_3.0.0
## [51] marray_1.80.0 backports_1.5.0
## [53] BiocParallel_1.36.0 carData_3.0-5
## [55] highr_0.11 gplots_3.1.3.1
## [57] ggsignif_0.6.4 MASS_7.3-60
## [59] drc_3.0-1 DelayedArray_0.28.0
## [61] gtools_3.9.5 caTools_1.18.2
## [63] tools_4.3.2 httpuv_1.6.15
## [65] relations_0.6-13 glue_1.7.0
## [67] promises_1.3.0 grid_4.3.2
## [69] cluster_2.1.4 fgsea_1.28.0
## [71] generics_0.1.3 gtable_0.3.5
## [73] KMsurv_0.1-5 tzdb_0.4.0
## [75] survminer_0.4.9 data.table_1.15.4
## [77] hms_1.1.3 car_3.1-2
## [79] utf8_1.2.4 XVector_0.42.0
## [81] BiocGenerics_0.48.1 maxstat_0.7-25
## [83] pillar_1.9.0 limma_3.58.1
## [85] later_1.3.2 splines_4.3.2
## [87] lattice_0.21-9 renv_1.0.7
## [89] survival_3.5-7 tidyselect_1.2.1
## [91] dr4pl_2.0.0 knitr_1.48
## [93] gridExtra_2.3 IRanges_2.36.0
## [95] SummarizedExperiment_1.32.0 stats4_4.3.2
## [97] xfun_0.45 shinydashboard_0.7.2
## [99] Biobase_2.62.0 statmod_1.5.0
## [101] matrixStats_1.3.0 DT_0.33
## [103] visNetwork_2.1.2 stringi_1.8.4
## [105] yaml_2.3.9 evaluate_0.24.0
## [107] codetools_0.2-19 cli_3.6.3
## [109] systemfonts_1.1.0 xtable_1.8-4
## [111] Rdpack_2.6 munsell_0.5.1
## [113] jquerylib_0.1.4 survMisc_0.5.6
## [115] exactRankTests_0.8-35 Rcpp_1.0.12
## [117] GenomeInfoDb_1.38.8 sets_1.0-25
## [119] bitops_1.0-7 mvtnorm_1.2-5
## [121] slam_0.1-50 scales_1.3.0
## [123] crayon_1.5.3 rlang_1.1.4
## [125] fastmatch_1.1-4 multcomp_1.4-25
## [127] shinyjs_2.1.0